<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var str = "nice to meet you";
    //str.slice(start,end);
    //截取字符串包含start位置字符
    //不包含end位置字符
    var childStr = str.slice(0,3);
    console.log(childStr);
    var str1 = str.slice(0,7);
    document.writeln(str1);
//  str.slice(start);
//  从截取位置开始到整个字符串结束
    var str2 = str.slice(1);
    document.write(str2);

    var str3 = str.slice(-5);
    console.log(str3);
</script>
</html>